package com.dlwx.parttimetalent.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.dlwx.parttimetalent.R;
import com.dlwx.parttimetalent.bean.ContactsBean;
import com.dlwx.parttimetalent.inter.PositionInter;

/**
 * Created by Administrator on 2017/11/21.
 */

public class ContactsAdapter extends ListBaseAdapter<ContactsBean.BodyBean> {
    private  Context context;
    private PositionInter inter;
    public ContactsAdapter(Context context, PositionInter inter) {
        super(context);
        this.context=context;
        this.inter=inter;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_contacts;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, final int position) {
        final ContactsBean.BodyBean bean = getDataList().get(position);
        TextView tvName = holder.getView(R.id.tv_name);
        TextView tvRemark = holder.getView(R.id.tv_remark);
        final TextView tvConfirm = holder.getView(R.id.tv_confirm);
        ImageView image_header = holder.getView(R.id.image_header);
        tvName.setText(bean.getNickname());
        tvRemark.setText(bean.getPhonename());
        Glide.with(context).load(bean.getHeadurl()).into(image_header);
        tvConfirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                inter.callBack(position);
            }
        });

    }


}
